﻿@model AutoPartsSearch.Web.Areas.Administration.Models.SellerAccount.ViewModel
@{
    ViewBag.Title = "Details";
    Layout = "~/Areas/Administration/Views/_Layout.cshtml";
}
<h2>
    Детали продавца</h2>
<div>
    
    @using (Html.BeginForm("Quote", "SellerAccounts", new { id = Model.Id, enable = !Model.IsQuoteEnabled }, FormMethod.Post))
    {
        if (Model.IsQuoteEnabled)
        {
        <input type="submit" value="Деактивировать котировки" />
        }
        else
        {
        <input type="submit" value="Активировать котировки" />
        }
    }

    @using (Html.BeginForm("Block", "SellerAccounts", new { id = Model.Id, block = !Model.IsBlocked }, FormMethod.Post))
    {
        if (Model.IsBlocked)
        {
            <input type="submit" value="Разблокировать" />
        }
        else
        {
            <input type="submit" value="Заблокировать" />
        }
    }
</div>
<br />
<br />
<div>
    @using (Html.BeginForm("UpdateExpiredDate", "SellerAccounts"))
    {
        @Html.HiddenFor(model => model.Id)
        <span>Активен до:</span> <input type="text" value="@Model.Expired.ToString("dd/MM/yyyy")" name="Expired" id="Expired"/> 
        <input type="submit" value="Изменить дату" />
    }
    @using (Html.BeginForm("Delete", "SellerAccounts"))
    {
        @Html.HiddenFor(model => model.Id)
        <input id="delete" type="submit" value="Удалить" style="float: right;" />
    }
</div>
<br />
<br />
<fieldset>
    <table id="step1" class="table-form">
        <tbody>
            <tr>
                <td>
                    Тип лица
                </td>
                <td>@(Model.IsIndividual ? "Физическое" : "Юридическое")
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(model => model.CompanyName)
                </td>
                <td>
                    @Html.DisplayFor(model => model.CompanyName)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(model => model.FullName)
                </td>
                <td>
                    @Html.DisplayFor(x => x.FullName)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(model => model.DirectorName)
                </td>
                <td>
                    @Html.DisplayFor(x => x.DirectorName)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(model => model.INN)
                </td>
                <td>
                    @Html.DisplayFor(x => x.INN)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(x => x.Code)
                </td>
                <td>
                    @Html.DisplayFor(x => x.Code)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(model => model.Adress)
                </td>
                <td>
                    @Html.DisplayFor(model => model.Adress)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(model => model.City)
                </td>
                <td>
                    @Html.DisplayFor(model => model.City)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(model => model.Site)
                </td>
                <td>
                    @Html.DisplayFor(model => model.Site)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(model => model.CarBrands)
                </td>
                <td>
                    @Html.DisplayFor(model => model.CarBrands)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(model => model.PartGroups)
                </td>
                <td>
                    @Html.DisplayFor(model => model.PartGroups)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(model => model.IsDeliveryOnlyToRegion)
                </td>
                <td>
                    @Html.DisplayFor(model => model.IsDeliveryOnlyToRegion)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(model => model.ReceiveQueriesByEmail)
                </td>
                <td>
                    @Html.DisplayFor(model => model.ReceiveQueriesByEmail)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(model => model.Phone)
                </td>
                <td>
                    @Html.DisplayFor(model => model.Phone)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(model => model.Phone2)
                </td>
                <td>
                    @Html.DisplayFor(model => model.Phone2)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(model => model.MobilePhone)
                </td>
                <td>
                    @Html.DisplayFor(model => model.MobilePhone)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(model => model.EMail)
                </td>
                <td>
                    @Html.DisplayFor(model => model.EMail)
                </td>
            </tr>
            <tr>
                <td>
                    @Html.LabelFor(model => model.BlackListCount)
                </td>
                <td>
                    @if (Model.BlackListCount > 0)
                    {
                        @Html.ActionLink(Model.BlackListCount.ToString() + " записей",
                                               "BySeller",
                                               "BlackList",
                                               new { sellerCode = Model.Code.ToString() },
                                               new { style = "color: red;" })
                    }
                    else
                    {
                        <span>Нет</span>
                    }
                </td>
            </tr>
            <tr>
                <td>
                    Создан
                </td>
                <td>
                    @Model.Created.ToString("dd/MM/yyyy hh:mm")
                </td>
            </tr>
        </tbody>
    </table>
</fieldset>
@Html.ActionLink("Обратно к списку", "List")
@section Styles
{
    <link rel="stylesheet" type="text/css" href="~/Content/themes/base/jquery.ui.all.css" />
}
@section Scripts
{
    <script type="text/javascript">
        $(function () {
            $('#Expired').datepicker({
                dateFormat: "dd/mm/yy"
            });

            $("#delete").click(function (e) {
                if (confirm("Вы действительно хотите удалить этот запрос из списка?")) {
                    return true;
                } else {
                    e.preventDefault();
                    return false;
                }
            });
        });
    </script>
}
